#ifndef COMPONENT_H
#define COMPONENT_H

#include <QObject>
#include <QString>
#include <QPointF>
#include <QIcon>
#include <QDateTime> // 添加缺失的头文件

class Component : public QObject {
    Q_OBJECT
public:
    Component(const QString& name, QObject* parent = nullptr);
    virtual ~Component() = default;

    // 基本信息
    QString getName() const;
    QIcon getIcon() const;
    QPointF getPosition() const;

    // 功率状态
    virtual double getPower() const;
    virtual void setPower(double value);

    // 仿真更新
    virtual void update(int timeStep, double dt) = 0;

    // 参数修改
    virtual void modifyParameters();

signals:
    void parametersChanged();

protected:
    QString m_name;
    QIcon m_icon;
    QPointF m_position;
    double m_power = 0.0;
};

#endif // COMPONENT_H
